-
Notifications
You must be signed in to change notification settings - Fork 12
Evolog - Support for actions and program modularization #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
madmike200590
wants to merge
63
commits into
master
Choose a base branch
from
evolog-final
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…e StratifiedEvaluation
…st<Term>> rather than just Set<List<ConstantTerm>> so we can have module interpretations returning function terms
…s interpretations for module literals by wrapping calls to the ASP solver.
…n. Add very simple end2end test with module-based 3-coloring implementation.
…cluding unit tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support for actions and program modularization
Detailed formal semantics for both actions and modules are described in Chapter 3 of [1].
Action Rules
Overview
Action rules allow for so-called side-effects in an ASP program, i.e. when an action rule fires, certain changes (such as opening or writing to files) can be applied to the environment. Consider the following Hello World-style example:
The rule on line 2 is an action rule:
hello_result(R) : @streamWrite[STDOUT, TEXT] = Ris an action head, wherehello_result(R)is a regular head atom, but@streamWrite[STDOUT, TEXT] = Rreferences an action function that has 2 input terms (variablesSTDOUTandTEXT) and yields the result termR.@streamWrite[STDOUT, TEXT]writes the stringTEXTto the file descriptorSTDOUT. VariableSTDOUTis bound by an external atom&stdout(STDOUT)which always supplies a reference to the standard output stream.Semantics and Restrictions
To stay in line with ASPs declarative semantics, action rulesin Alpha
Hello World!is only written to the console once, regardless of the solver's actual evaluation strategy.Implementation
Rules with action heads are modelled as instances of
NormalRulewhose head is an instance ofActionHead:[1]: https://repositum.tuwien.at/handle/20.500.12708/220293 Michael Langowski. Evolog-Actions and Modularization in Lazy-Grounding Answer Set Programming. Master Thesis, Technische Universität Wien, 2025.